<!DOCTYPE html>
<html lang="">
    <head>
        <meta charset="utf-8">
        <meta http-equiv="X-UA-Compatible" content="IE=edge">
        <meta name="viewport" content="width=device-width,initial-scale=1.0">
        <link rel="icon" href="<%= BASE_URL %>favicon.ico">
        <title><%= htmlWebpackPlugin.options.title %></title>
        <style>
            body {
                margin: 0;
                padding: 0;
            }
        </style>
        <script type="text/javascript">

            let base_ip = "localhost";
            let base_port = "9999";
            //设置参数
            window.global_value = {
                VUE_APP_DEFAULT_TITLE: 'maben',
                VUE_APP_API_URL: "http://" + base_ip + ":" + base_port ,
                VUE_APP_WEBSOCKET_URL: base_ip + ":" + base_port ,
                VUE_APP_BMAP_OFFLINE: "http://" + base_ip + "/bmap-offline", //使用nginx做地图服务器
                VUE_APP_VERSION: '©XXX有限公司 V1.0', //版本信息
                VUE_APP_MAP_MAX_ZOOM: 18,//地图最大层级
                TOKEN_KEY:"Access-Token", //token缓存key
            };
            let url = window.location.href; // 获取当前URL
            console.log("获取当前URL", url);
            let hostname = window.location.hostname;// 获取当前ip
            console.log("获取当前ip", hostname);
            let port = window.location.port;// 获取当前端口
            console.log("获取当前端口", port);
            let host = window.location.host;//当前访问的IP和端口
            console.log("当前访问的IP和端口", host);
            //设置ip和端口
            if (hostname != "localhost") {
                base_ip = hostname;
                base_port = port;
                window.global_value.VUE_APP_API_URL = "http://" + base_ip + ":" + base_port ;
                window.global_value.VUE_APP_WEBSOCKET_URL = base_ip + ":" + base_port ;
                window.global_value.VUE_APP_BMAP_OFFLINE = "http://" + base_ip + ":" + base_port + "/bmap-offline";
            }
        </script>
    </head>
    <body>
        <noscript>
            <strong>We're sorry but <%= htmlWebpackPlugin.options.title %> doesn't work properly without JavaScript
                enabled. Please enable it to continue.
            </strong>
        </noscript>
        <div id="app"></div>
    </body>
</html>
